<template>
    <view class="pub_page pub_page_bg pub_goods_list pub_header_padding">
        <pub-head headerName="goods_list" :headerConfig="headerConfig"></pub-head>
        <z-paging ref="Zpaging" class="pub_page_scroll page_box" v-model="list" @query="getList"
            :refresher-enabled="false" :fixed="false" :empty-view-title-style="{color:'#fff'}">
            <div class="goods_div" v-if="list.length">
                <div class="li" v-for="(li,key) in list" :key="key"
                    @click="$comFun.openWin('/pages/index/good_info', { orderType: 1,id:li.id })">
                    <div class="title">{{ li.goodsName }}</div>
                    <pub-image class="img" :src="li.coverImg" :mode="'aspectFit'"></pub-image>
                    <div class="cont">
                        <div class="text">
                            <div class="price">{{ li.sellPrice }}</div>
                            <div class="msg">
                                <div class="msg_1">￥</div>
                                <div class="msg_2">活动价</div>
                            </div>
                        </div>
                        <div class="btn">立即抢购</div>
                    </div>
                </div>
            </div>
        </z-paging>
    </view>
</template>

<script>
export default {
    data() {
        return {
            headerConfig: {
                title: '自营商品',//标题栏内容
                left_type: 3,
                title_color: '#fff',
                header_color: '#D31318'
            },
            list: []
        };
    },
    onLoad() {
        setTimeout(() => {
            this.$comFun.openLoading();
            this.$refs.Zpaging.reload()
        }, 400);
    },
    methods: {
        async getList(pageNo, pageSize) {
            let data = {
                pageNo: pageNo,
                pageSize: pageSize,
                categoryId: 1,
            };
            const res = await this.$request.get('goods/getGoodsPage', data);
            this.$comFun.closeLoading();
            // console.log(res);
            if (res.code == 200) {
                this.$refs.Zpaging.complete(res.result.records);
            } else {
                this.$refs.Zpaging.complete(false);
            }
        },
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/goods.scss";
</style>
